﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Threading.Tasks;
using System.Windows;

namespace ArmA_Launcher
{
    public class ShowMessageCommand : ICommand
    {

        public void Execute(object parameter)
        {
            switch (parameter.ToString())
            {
                case "single_click":
                    //Console.WriteLine ("Single Click Event On Icon");
                    break;
                case "double_click":
                    //Console.WriteLine("Double Click Event On Icon");
                    changeState();
                    break;
            }
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void changeState()
        {
            //Toggle Window State
            string test = Application.Current.Properties["windowVisible"].ToString();
            if ( test == "true")
            {
                Application.Current.MainWindow.WindowState = WindowState.Minimized;
                Application.Current.MainWindow.Hide();
                Application.Current.Properties["windowVisible"] = "false";
            }
            else
            {
                Application.Current.MainWindow.Show();
                Application.Current.MainWindow.Activate();
                Application.Current.MainWindow.WindowState = WindowState.Normal;
                Application.Current.Properties["windowVisible"] = "true";
            }
        }
    } 
}
